package br.com.lh.urabuilder.view
{
	import br.com.lh.urabuilder.view.arrow.ArrowWrapper;
	
	import flash.geom.Point;
	
	import mx.containers.Canvas;
	import mx.core.UIComponent;
	
	public class ArrowDynamicDrawer
	{
		private var fakeComponent:UIComponent;
		private var parentComponent:Canvas;
		
		public function ArrowDynamicDrawer(parentComponent:Canvas){
			this.parentComponent = parentComponent;
			fakeComponent = new UIComponent();
		}
		
		public function rotateArrow(startPoint:Point,endPoint:Point):void{
			if (parentComponent.contains(fakeComponent)){
				parentComponent.removeChild(fakeComponent);
			}
			startPoint = new Point(startPoint.x - parentComponent.x, startPoint.y - parentComponent.y);
			endPoint = new Point (endPoint.x - parentComponent.x,endPoint.y - parentComponent.y);
			fakeComponent = new ArrowWrapper(startPoint,endPoint);
			trace("Start " + startPoint.x + " y" + startPoint.y);
			trace('End ' + endPoint.x + ' y' + endPoint.y);
			parentComponent.addChild(fakeComponent);
			
		}
		

	}
}